home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PsL Monthly 1993 December
/
PSL Monthly Shareware CD-ROM (December 1993).iso
/
prgmming
/
dos
/
pascal
/
gsdbloo.exe
/
GSDBLOOK.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1992-02-27
|
13KB
|
539 lines
program GSdBLook;
uses
CRT,
DOS,
GS_Lst,
GS_FileH,
GS_KeyI,
GS_dBFld,
GS_Pick,
GS_Winfc,
GS_dBTbl,
GS_dBase;
const
Initial_Count = 7;
Initial_Choice : array [1..Initial_Count] of string[9] =
(' Edit',' Append',' Select',' Print',
' Pack',' Info',' Exit');
type
Look_Obj = object(GS_dBFld_Objt)
constructor Init(FName : string);
procedure StatusUpdate(statword1,statword2,
statword3 : longint); virtual;
end;
var
Look : Look_Obj;
LookIndex,
LookName : string;
CreditWin,
FileWin,
FieldWin,
PrintWin,
AskWin,
StatusWin,
TalkWin,
LookWin : GS_Wind_Objt;
LookTab : dbTabl_Pick_Obj;
L : PathStr;
constructor Look_Obj.Init(FName : string);
begin
GS_dBFld_Objt.Init(FName);
TalkWin.InitWin(10,10,70,15,Blue,LightGray,Yellow,LightGray,Black,true,
'',true);
end;
procedure Look_Obj.StatusUpdate(statword1,statword2,statword3 : longint);
begin
case statword1 of
StatusStart : begin
case statword2 of
StatusPack : TalkWin.NamWin('[ Pack Progress ]');
StatusIndexTo : TalkWin.NamWin
('[ Index Progress ]');
end;
TalkWin.SetWin;
GotoXY(26,3);
write('Total Records to Process = ',statword3);
end;
StatusStop : TalkWin.RelWin;
StatusPack,
StatusIndexTo : begin
GoToXy(2,3);
write('Record Number ',statword2,' ');
end;
end;
end;
function SelField(MemoOk : boolean) : string;
var
FilTabl : array[1..128] of string[12];
Labl : string;
itms : integer;
slct : integer;
lctn : integer;
begin
itms := 0;
lctn := 0;
while itms < Look.NumFields do
begin
inc(itms);
if MemoOk then
begin
inc(lctn);
FilTabl[lctn] := Look.FieldsN^[itms];
end
else
begin
if Look.Fields^[itms].FieldType <> 'M' then
begin
inc(lctn);
FilTabl[lctn] := Look.FieldsN^[itms];
end;
end;
end;
FieldWin.SetWin;
slct := GS_Pick_Row_Item(FilTabl, 13, lctn, 1);
FieldWin.RelWin;
if slct > 0 then Labl := FilTabl[slct] else Labl := '';
SelField := Labl;
end;
function GetExt(pth, ext : string; LookElseWhere : boolean) : string;
var
Labl : string;
begin
FileWin.SetWin;
Labl := GS_FileFindFiles(pth,ext,LookElseWhere);
FileWin.RelWin;
if Labl = '-' then Labl := '';
GetExt := Labl;
end;
procedure FileEdit;
var
i,
ml : integer;
vl,
vs : boolean;
aw : string[1];
begin
StatusWin.SetWin;
write('':10,'ESC to Abort, F10 For Next Record,',
' F9 to Delete/Undelete');
LookWin.SetWin;
if Look.RecNumber < 1 then
Look.GetRec(Top_Record)
else
Look.GetRec(Look.RecNumber);
vl := true;
while vl do
begin;
ClrScr;
begin
vs := false;
vl := Look.FieldUpdateScreen;
if not vl then
begin
if Look.RecChanged then
begin
AskWin.NamWin('');
AskWin.SetWin;
gotoxy(1,1);
writeln(' Record has been modified!');
write(' Save before exit? ');
aw := Look.EditString('Y',21,2,1);
vs := aw[1] in ['T','t','Y','y'];
AskWin.RelWin;
end;
end;
if vl or vs then
begin
Look.PutRec(Look.RecNumber);
if GS_KeyI_Chr = Kbd_PgUp then
Look.GetRec(Prev_Record)
else
Look.GetRec(Next_Record);
end;
end;
end;
LookWin.RelWin;
StatusWin.RelWin;
end;
procedure FileAppend;
var
i,
ml : integer;
vc,
vl,
vs : boolean;
aw : string[1];
begin
StatusWin.SetWin;
write('':10,'ESC to Quit, F10 For Next Record,',
' F9 to Delete/Undelete');
LookWin.SetWin;
Look.GetRec(Top_Record);
vl := true;
vc := true;
while vl do
begin;
ClrScr;
begin
vs := false;
vl := Look.FieldAppendScreen(vc);
vc := false;
if not vl then
begin
if Look.RecChanged then
begin
AskWin.NamWin('');
AskWin.SetWin;
gotoxy(1,1);
writeln(' Record has been modified!');
write(' Save before exit? ');
aw := Look.EditString('Y',21,2,1);
vs := aw[1] in ['T','t','Y','y'];
AskWin.RelWin;
end;
end;
if vl or vs then
begin
Look.Append;
LookTab.Reset_dBTabl;
end;
end;
end;
LookWin.RelWin;
StatusWin.RelWin;
end;
procedure ShowFile;
var
i,
ml : integer;
vl,
vs : boolean;
aw : string[1];
begin
StatusWin.SetWin;
write('':10,'ESC to Abort, F10 to Quit and Save,',
' F9 to Delete/Undelete');
LookWin.SetWin;
vl := true;
begin;
ClrScr;
if LookTab.Addrec then
begin
vs := false;
vl := Look.FieldAppendScreen(true);
if not vl then
begin
if Look.RecChanged then
begin
AskWin.NamWin('');
AskWin.SetWin;
gotoxy(1,1);
writeln(' Record has been modified!');
write(' Save before exit? ');
aw := Look.EditString('Y',21,2,1);
vs := aw[1] in ['T','t','Y','y'];
AskWin.RelWin;
end;
end;
if vl or vs then
begin
Look.Append;
LookTab.Reset_dBTabl;
end;
end
else
begin
vs := false;
vl := Look.FieldUpdateScreen;
if not vl then
begin
if Look.RecChanged then
begin
AskWin.NamWin('');
AskWin.SetWin;
gotoxy(1,1);
writeln(' Record has been modified!');
write(' Save before exit? ');
aw := Look.EditString('Y',21,2,1);
vs := aw[1] in ['T','t','Y','y'];
AskWin.RelWin;
end;
end;
if vl or vs then
begin
Look.PutRec(Look.RecNumber);
if GS_KeyI_Chr = Kbd_PgUp then
Look.GetRec(Prev_Record)
else
Look.GetRec(Next_Record);
end;
end;
end;
LookWin.RelWin;
StatusWin.RelWin;
end;
procedure FileDisplay;
var
t : string[8];
fn : string[12];
i : integer;
z,
wcr : boolean;
begin
fn := SelField(false);
if fn = '' then exit;
wcr := Look.Wait_CR;
Look.Wait_Cr := true;
AskWin.NamWin('[ Search Criteria ]');
AskWin.SetWin;
gotoxy(1,1);
write('Enter select criteria:');
t := Look.EditString('',8,2,20);
Look.Wait_CR := wcr;
AskWin.RelWin;
if GS_KeyI_Esc then exit;
LookTab.Reset_dBTabl;
repeat
StatusWin.SetWin;
write('':22,'ESC to Exit, RETURN to Select Entry');
if LookTab.Tabl = nil then
z := LookTab.Scan_dBTabl(fn,t,fn)
else
begin
LookTab.Pick_Win.SetWin;
z := LookTab.Choose_dBTabl;
LookTab.Pick_Win.RelWin;
end;
StatusWin.RelWin;
if z then ShowFile;
until not z;
LookTab.Reset_dBTabl;
end;
procedure Print_List;
var
i,
ml,
lines : integer;
swork : string;
vs : boolean;